package com.yinhe.music.yhmusic.radio;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.yinhe.music.common.GlideHelper.GlideHelper;
import com.yinhe.music.yhmusic.R;
import com.yinhe.music.yhmusic.base.BaseFragment;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;


/**
 * 电台介绍
 *
 * @author hasee
 * @date 2017/3/3
 */

public class RadioDetailFragment extends BaseFragment {
    @BindView(R.id.content)
    TextView content;
    Unbinder unbinder;
    @BindView(R.id.image)
    ImageView image;
    @BindView(R.id.anchor_name)
    TextView anchorName;
    private String mDetail;
    private String mName;
    private String mImageUrl;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.detail, container, false);
        if (getArguments() != null) {
            mDetail = getArguments().getString("detail");
            mName = getArguments().getString("anchor");
            mImageUrl = getArguments().getString("userImg");
        }
        unbinder = ButterKnife.bind(this, view);

        anchorName.setText(mName);
        GlideHelper.setCircleImageResource(image, mImageUrl);

        if (mDetail.length() > 0) {
            content.setText(mDetail);
        } else {
            content.setText("暂无更多详情");
        }

        return view;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

}
